<?php include("../Service/WebClass/report/CreativeClass.php");
$creative = new Creative;
$creative->MyTask();
?>





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- DW6 -->
<head>
<!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
<title>クリエイティブ別集計分析</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../css/common.css" type="text/css" />
<script language="JavaScript" src="../js/common.js" type="text/javascript"></script>
<script language="JavaScript" src="../js/Calendar4.js" type="text/javascript"></script>
<script>
function do_csv()
{
	document.getElementById("act").value = "csv";
	document.getElementById("mainform").submit();	
}
function do_search(actValue)
{
	if(document.getElementById("search_detail").style.display != "none")
	{
		if(checkFilter() == false)
		{
			alert("整数値を入力してください。");
			return false;
		}		
	}
	
	document.getElementById("act").value = actValue;
	// 詳細検索状態をセットする
	if(document.getElementById("search_detail").style.display == "none")
	{
		// 詳細検索は非表示の場合
		document.getElementById("search_detail_hid").value = "display:none";
	}
	else
	{
		// 詳細検索は表示の場合
		document.getElementById("search_detail_hid").value = null;
	}
	document.getElementById("mainform").submit();	
}

function checkFilter()
{
	var regexs = /^[1-9]+[0-9]*$/;
	if(document.getElementById("filter_value").value != "" && document.getElementById("filter_value").value != "")
	{
		var result1 = regexs.test(document.getElementById("filter_value").value);
		if(result1 == false)
		{
			return false;
		}		
	}
	if(document.getElementById("filter3_value").value != "" && document.getElementById("filter3_value").value != "")
	{
		var result3 = regexs.test(document.getElementById("filter3_value").value);
		if(result3 == false)
		{
			return false;
		}
	}
	return true;
}

function do_delete_update(mod)
{
	var isCheck = false;
	var creativeIdCheck = document.getElementsByName("sel");
	var creativeIdList="0";
	for(i=0;i<creativeIdCheck.length;i++)
	{
		if(creativeIdCheck[i].checked == true)
		{
			creativeIdList = creativeIdList + "," + creativeIdCheck[i].value;
			isCheck = true;
		}
	}
	if(isCheck)
	{
		document.getElementById("creativeIdList").value = creativeIdList;
		if(mod == "delete")
		{
			document.getElementById("act").value = "delete";
			document.getElementById("mainform").submit();			
		}
		else
		{
			var url = "creativeUpdAll.php?creativeIds=" + creativeIdList;
			window.open(url);
		}
	}
	else
	{
		alert("クリエイティブを選択してください。");
		return false;
	}
}
</script>	

</head>
<body bgcolor="#F4FFE4">  
<?php include("../head.php");?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">

 <tr>
    <td width="165" valign="top" bgcolor="#5C743D"><?php include("../menu.php");?>
    <div class="sidemenu1">表示形式</div>
<form name="mainform" id="mainform" method="post">
<input type=hidden id="nowPage" name="nowPage" value="1">
<input type=hidden id="creativeIdList" name="creativeIdList">
<div class="sidemenu4">
	<input name="report_axis" id="axis_id" value="id" onclick="javascript:document.getElementById('nowPage').value = 1;do_search('submit');" type="radio"><label for="axis_id">クリエイティブ別</label><br>
	<input name="report_axis" id="axis_d" value="d" onclick="javascript:document.getElementById('nowPage').value = 1;do_search('submit');" type="radio"><label for="axis_d">日別</label><br>
	<input name="report_axis" id="axis_w" value="w" onclick="javascript:document.getElementById('nowPage').value = 1;do_search('submit');" type="radio"><label for="axis_w">週別</label><br>
	<input name="report_axis" id="axis_dow" value="dow" onclick="javascript:document.getElementById('nowPage').value = 1;do_search('submit');" type="radio"><label for="axis_dow">曜日別</label><br>
	<input name="report_axis" id="axis_m" value="m" onclick="javascript:document.getElementById('nowPage').value = 1;do_search('submit');" type="radio"><label for="axis_m">月別</label><br>
	<script>
	var list = document.getElementsByName("report_axis");
	var i;
	for(i=0;i<list.length;i++)
	{
		if(list[i].value == "<?php echo $creative->reportAxis;?>")
		{
			list[i].checked = true;
			break;
		}
	}
	</script>	
</div>
    </td>
    <td width="813" colspan="2" align="center" valign="top">
<?php
echo "<input type=hidden name=act id=act value=submit>"
?>
<!-- search_area start -->
<table width="100%" border="0" cellpadding="4" cellspacing="0" class="tbl where">
	<tr>
		<td>
<input type="text" name="from_date" id="cal_input_from" value="<?php echo $creative->fromDate;?>" class="txBox" style="width: 65px;">
<a href="javascript:void(0)" onclick="if(self.gfPop)gfPop.fPopCalendar(getObjById('cal_input_from'));return false;" HIDEFOCUS>
<img name="popcal2" align="top" src="../images/cal.gif" border="0" alt="calendar" onclick="MyCalendar.SetDate(this,document.getElementById('cal_input_from'))"></a>
-
<input type="text" name="to_date" id="cal_input_to" value="<?php echo $creative->toDate;?>" class="txBox" style="width: 65px;">
<a href="javascript:void(0)" onclick="if(self.gfPop)gfPop.fPopCalendar(getObjById('cal_input_to'));return false;" HIDEFOCUS>
<img name="popcal2" align="top" src="../images/cal.gif" border="0" alt="calendar" onclick="MyCalendar.SetDate(this,document.getElementById('cal_input_to'))"></a>
&nbsp;&nbsp;
<input type="button" class="btn search" onclick="javascript:document.getElementById('nowPage').value = 1;do_search('submit');">
&nbsp;&nbsp;
<input type="button" class="btn btn_wider" value="▼詳細検索..." onclick="openCloseSearchDetail();">
		</td>
	</tr>

	<tr id="search_detail" style="<?php echo $creative->searchDetailHid?>">
	<input type=hidden name=search_detail_hid id=search_detail_hid>		
		<td><select name="search_col" id="search_col" class="txBox">
	<option value="Crt_Id" >クリエイティブID
	<option value="name">クリエイティブ名
	<option value="description1" >description1
	<option value="description2" >description2
	<option value="headline" >タイトル
</select>
<script>document.getElementById("search_col").value = "<?php echo $creative->searchCol;?>";</script>		
<input type="text" name="search_text" size="35" maxlength="100" value="<?php echo $creative->searchText;?>" class="txBox">
<select name="search_type" id="search_type" class="txBox">
	<option value="0">全部一致
	<option value="1" >部分一致
</select>
<script>document.getElementById("search_type").value = "<?php echo $creative->searchType?>";</script>		
&nbsp;&nbsp;<br><img src="../images/spacer.gif" width="1" height="5" border="0"><br>
<select name="filter_col" id="filter_col" class="txBox">
				<option value="impression" >Imp
				<option value="clickCnt" >Click
				<option value="ctr" >CTR[%]
				<option value="cv" >CV
				<option value="cvr" >CVR[%]
				<option value="sales" >売上[円]
				<option value="salesValue" >売上単価[円]
				<option value="directCvCnt" >直接
				<option value="indirectCvCnt" >間接
				<option value="asistCvCnt" >アシスト
				<option value="postCvCnt" >ポスト効果
			  </select>
<script>document.getElementById("filter_col").value = "<?php echo $creative->filterCol;?>";</script>	
<input type="text" name="filter_value" id="filter_value" size="10" maxlength="10" value="<?php echo $creative->filterValue;?>" class="txBox">

<select name="filter_type" id="filter_type" class="txBox">
	<option value="1" >以上
	<option value="2" >以下
</select>
<script>document.getElementById("filter_type").value = "<?php echo $creative->filterType;?>";</script>		
&nbsp;&nbsp;
<select name="filter3_col" id="filter3_col" class="txBox">
				<option value="impression" >Imp
				<option value="clickCnt" >Click
				<option value="ctr" >CTR[%]
				<option value="cv" >CV
				<option value="cvr" >CVR[%]
				<option value="sales" >売上[円]
				<option value="salesValue" >売上単価[円]
				<option value="directCvCnt" >直接
				<option value="indirectCvCnt" >間接
				<option value="asistCvCnt" >アシスト
				<option value="postCvCnt" >ポスト効果
			  </select>
<script>document.getElementById("filter3_col").value = "<?php echo $creative->filter3Col;?>";</script>
<input type="text" name="filter3_value" id="filter3_value" size="10" maxlength="10" value="<?php echo $creative->filter3Value;?>" class="txBox">
<select name="filter3_type" id="filter3_type" class="txBox">
	<option value="1">以上
	<option value="2" >以下
</select>
<script>document.getElementById("filter3_type").value = "<?php echo $creative->filter3Type;?>";</script>	
&nbsp;&nbsp;
<br><img src="view/images/spacer.gif" width="1" height="5" border="0"><br>
<?php echo "<input type=hidden name=isMediaSelectClick id=isMediaSelectClick value=0>"?>	
媒体
<select name="search_media_select" id="search_media_select" onchange="javascript:document.getElementById('nowPage').value = 1;document.getElementById('isMediaSelectClick').value=1;do_search('submit');" class="txBox">
	<option value="0" >(指定なし)
	<?php echo $creative->mediaOptionList;
	?>
</select>
<script>document.getElementById("search_media_select").value = "<?php echo $creative->searchMediaSelect;?>"</script>				
&nbsp;&nbsp;

キャンペーン
<select name="search_campaign_select" id="search_campaign_select" onchange="javascript:document.getElementById('nowPage').value = 1;document.getElementById('act').value = 'getGroup';do_search('getGroup');" class="txBox">
	<option value="0" >(指定なし)
	<?php echo $creative->campaignOptionList;?>
	</select>
<script>document.getElementById("search_campaign_select").value = "<?php echo $creative->searchCampaignSelect;?>"</script>		
&nbsp;&nbsp;
広告グループ
<select name="search_banner_select" id="search_banner_select" onchange="javascript:document.getElementById('nowPage').value = 1;do_search('submit');" class="txBox">
	<option value="0" >(指定なし)
	<?php echo $creative->adgroupOptionList;?>
	</select>
<script>document.getElementById("search_banner_select").value = "<?php echo $creative->searchBannerSelect;?>"</script>				
&nbsp;&nbsp;
同期状態
<select name="search_sync" id="search_sync" onchange="javascript:document.getElementById('nowPage').value = 1;do_search('submit');" class="txBox">
	<option value="0">(指定なし)
	<option value="2" >更新待ち
	<option value="1" >同期済
	<option value="3" >エラー
</select>
<script>document.getElementById("search_sync").value = "<?php echo $creative->searchSync;?>"</script>		
&nbsp;&nbsp;		</td>
	</tr>
</table>
<!-- search_area end -->
<span id="backGroup" style="display:none;">
<a href="javascript:var id=document.getElementById('search_campaign_select').value;var fromDate = document.getElementById('cal_input_from').value;var toDate=document.getElementById('cal_input_to').value;window.location='adGroup.php?campaignId='+ id+'&fromDate='+fromDate+'&toDate='+toDate;">
<img src="../images/branch_parent.gif" border=0>広告グループ別に戻る</a><br>
</span>					
<img src="../images/spacer.gif" width="1" height="5" border="0"><br>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr align="right">
			<span id="inputShowSpan" style="display:none;">
			<td align="left">
			<img src="../images/ico_graph.gif" border="0">
			<span class=input_title id="input_title"></td>
			</span>
			</span>			
			<script>
			var groupname = document.getElementById("search_banner_select").options[document.getElementById("search_banner_select").selectedIndex].text;
			if(document.getElementById("search_banner_select").value !="0")
			{
				document.getElementById("inputShowSpan").style.display = "block";
				document.getElementById("input_title").innerText = "[広告グループ]" + groupname;
			}
			</script>					
		<td width="100">
			<div class="tabview_tab tabview_tab_on">クリエイティブ</div>
		</td>
		<td width="5">&nbsp;</td>
		<td width="100">
			<a id="creativeTbV">
			<script>
				if(document.getElementById("search_detail").style.display != "none")
				{
					var url = "javascript:window.location='keyword.php";
					url = url + "?fromDate=" + document.getElementById("from_date").value;
					url = url + "&toDate=" + document.getElementById("to_date").value;
					url = url + "&mediaId=" + document.getElementById("search_media_select").value;
					url = url + "&campaignId=" + document.getElementById("search_campaign_select").value;
					url = url + "&adgroupId=" + document.getElementById("search_banner_select").value;
					url = url + "&displayFlg=1";
					url = url + "'";
					document.getElementById("creativeTbV").href = url;
				}
				else
				{
					var url = "javascript:window.location='keyword.php";
					url = url + "?fromDate=" + document.getElementById("from_date").value;
					url = url + "&toDate=" + document.getElementById("to_date").value;
					url = url + "&displayFlg=1";
					url = url + "'";
					document.getElementById("creativeTbV").href = url;
				}
			</script>
			<div class="tabview_tab tabview_tab_off">キーワード</div></a>
		</td>
	</tr>
</table>
<div class="tabview_area">
<img src="view/images/spacer.gif" width="1" height="5" border="0"><br>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tbl_clear">
	<tr height="30" valign="bottom">
		<td align="left">
			<img src="../images/ico_graph_line.gif" border="0">

						種類
			<select name="graph_type" id="graph_type" size="1" class="txBox" onchange="do_search('submit');">
				<option value="0">折れ線
				<option value="1">分布図
				</select>
			<script>document.getElementById("graph_type").value = "<?php echo $creative->graphType;?>"</script>								
			&nbsp;
			指標1
			<select name="graph_col1" id="graph_col1" size="1" class="txBox" onchange="do_search('submit');">
				  <option value="impression" >Imp
				  <option value="clickCnt">Click
				  <option value="ctr" >CTR[%]
				  <option value="cv" >CV
				  <option value="cvr" >CVR[%]
				  <option value="sales" >売上[円]
				  <option value="salesValue" >売上単価[円]
				  <option value="clickCvSpan" >Click-CV間隔[秒]
				  <option value="directCvCnt" >直接
				  <option value="indirectCvCnt" >間接
				  <option value="asistCvCnt" >アシスト
				  <option value="postCvCnt" >ポスト効果
				  <option value="position" >平均順位
			    </select>
				<script>document.getElementById("graph_col1").value = "<?php echo $creative->graphCol1;?>"</script>
			&nbsp;
			指標2
			<select name="graph_col2" id="graph_col2" size="1" class="txBox" onchange="do_search('submit');">
				  <option value="impression" >Imp
				  <option value="clickCnt" >Click
				  <option value="ctr" >CTR[%]
				  <option value="cv">CV
				  <option value="cvr" >CVR[%]
				  <option value="sales" >売上[円]
				  <option value="salesValue" >売上単価[円]
				  <option value="clickCvSpan" >Click-CV間隔[秒]
				  <option value="directCvCnt" >直接
				  <option value="indirectCvCnt" >間接
				  <option value="asistCvCnt" >アシスト
				  <option value="postCvCnt" >ポスト効果
				  <option value="position" >平均順位
			    </select>
				<script>document.getElementById("graph_col2").value = "<?php echo $creative->graphCol2;?>"</script>
						&nbsp;&nbsp;
			グラフサイズ
			<select name="graph_size" id="graph_size" size="1" class="txBox" onchange="do_search('submit');">
				<option value="0">標準
				<option value="1" >最大
				<option value="2" >非表示
			</select>
			<script>document.getElementById("graph_size").value = "<?php echo $creative->graphSize;?>"</script>							
		</td>
		<td align="right">
		<input type="button" class="btn_exp csv" title="CSV出力" value="" onclick="do_csv()"></td>
	</tr>
</table>
<div id="chart_area">
<?php
	// 初期化の場合、図は表示しない
	if($creative->graphSize == "2")
	{
	}
	else
	{
		$src = "../Service/Graph/report/CreativeGraph.php?reportAxis=".$creative->reportAxis."&fromDate=".$creative->fromDate;
		$src = $src."&toDate=".$creative->toDate."&searchDetail=".$creative->searchDetailHid;
		$src = $src."&searchCol=".$creative->searchCol."&searchText=".urlencode(trim($creative->searchText))."&searchType=".$creative->searchType;
		$src = $src."&filterCol=".$creative->filterCol."&filterValue=".$creative->filterValue."&filterType=".$creative->filterType;
		$src = $src."&filter3Col=".$creative->filter3Col."&filter3Value=".$creative->filter3Value."&filter3Type=".$creative->filter3Type;
		$src = $src."&searchMediaSelect=".$creative->searchMediaSelect."&searchCampaignSelect=".$creative->searchCampaignSelect."&searchBannerSelect=".$creative->searchBannerSelect."&searchSync=".$creative->searchSync."&graphType=".$creative->graphType;
		$src = $src."&graphCol1=".$creative->graphCol1."&graphCol2=".$creative->graphCol2."&graphSize=".$creative->graphSize."&showDeleted=".$creative->showDeleted."&selectPoint=".$creative->selectPoint;
		$src = $src."&nowPageNum=".$creative->nowPageNum;
		// 検索結果がない場合
		//if($campaign->searchResult != null)
		//{
			//echo $src;
			echo "<img id=graph src=".$src.">";
		//}		
	}
?>
</div>
<br>
<table width="100%" border="0" cellpadding="2" cellspacing="0">
	<tr>

		<td align="left">
			<img src="../images/ico_summary.gif" border="0">
ビュー
<select name="select_view" id="select_view" size="1" class="txBox" onchange="javascript:document.getElementById('nowPage').value = 1;do_search('submit');">
	<option value="1">標準ビュー
	<option value="2">コスト分析
	<option value="4" >コンバージョン
	</select>
<script>document.getElementById("select_view").value = "<?php echo $creative->selectView;?>"</script>				
&nbsp;&nbsp;

成果地点
<select name="select_point" id="select_point" size="1" class="txBox" onchange="javascript:document.getElementById('nowPage').value = 1;do_search('submit');">
	<option value="0">(すべて)
	<?php
	echo $creative->cvPointList;
	?>
	</select>
	<script>document.getElementById("select_point").value = <?php echo $creative->selectPoint; ?>;</script>		
&nbsp;&nbsp;
<input type="checkbox" name="show_deleted" id="show_deleted" value="1">
<?php if($_POST["show_deleted"] == "1")
	{
		echo "<script>document.getElementById('show_deleted').checked = true;</script>";
	}
?>	
<label for="show_deleted">削除済みも表示</label>		</td>
<td align="right" width="105px">
<span id="showBtnSpn" style="display:none">	
<input class="btn new" onclick="newGroup()" type="button">
<input type="button" class="btn" value="一括更新" onclick="do_delete_update('update');">
</span>
</td>
<td align="left" width="50px">
<input type="button" class="btn refresh" onclick="do_search('submit');">	
</td>
<td align="left">	
<span id="showDeleteBtn" style="display:none">	
<input type="button" class="btn del" onclick="do_delete_update('delete');">					
</span>	
</td>
</tr>
</table>
<script>
function newGroup()
{
	if(document.getElementById("search_media_select").value == "0"
	|| document.getElementById("search_campaign_select").value == "0"
	|| document.getElementById("search_banner_select").value == "0")
	{
		alert("媒体、キャンペーン、グループを選択してください。");
		return false;
	}
	else
	{
		var url = "creativeNew.php?listingType=" + document.getElementById("search_media_select").value;
		url = url + "&listingName=" + document.getElementById("search_media_select").options[document.getElementById("search_media_select").selectedIndex].text;
		url = url + "&campaignId=" + document.getElementById("search_campaign_select").value;
		url = url + "&adGroupId=" + document.getElementById("search_banner_select").value;
		window.open(url);		
	}
}
</script>	
<script>
// 非指定なしの場合		
if(document.getElementById("search_banner_select").value != "0")
{
	document.getElementById("backGroup").style.display = "block";
}
if(document.getElementById("axis_id").checked == true 
&& document.getElementById("search_banner_select").value !="0"
&& document.getElementById("search_media_select").value !="0"
&& document.getElementById("search_campaign_select").value !="0")
{
	document.getElementById("showBtnSpn").style.display = "block";
}

if(document.getElementById("axis_id").checked == true)
{
	document.getElementById("showDeleteBtn").style.display = "block";
}		
</script>	
<table width="100%" border="0" cellpadding="4" cellspacing="0" class="tbl">
	<tr align="right" class="tr2">
	<?php echo $creative->tableList;?>
	</table>

<table width="100%" border="0" cellpadding="2" cellspacing="0">
<tr align="right">
<td align="right">
<?php echo "<label id='fromToPage' name='fromToPage'>".$creative->fromToRowHtml."</label>";?>     
<?php echo "<label id='memberInfoCount' name='memberInfoCount'>".$creative->allRowHtml."</label>";?>
</td><td>
<?php echo $creative->pageLinkHtml;?>
		</td>
</table><br>

</div><br>


</form>

<a name="input_area_top"></a>
<div id="input_area">
	</div>			<!-- end of main area -->
    <br />
    <br />
    </td>

  </tr>
 </table>
<?php
include("../foot.php");
?>
</body>
</html>
